﻿Imports System.ComponentModel 
Imports System.Collections  


Public Class CIntermediario
Implements INotifyPropertyChanged

    
    Private _concepto              As String 
    Private _intermediario1        As double     
    Private _intermediario2        As double
    Private _intermediario3        As double
    Private _intermediario4        As double
    Private _intermediario5        As double
    Private _intermediario6        As double
    Private _intermediario7        As double
    Private _intermediario8        As double
    Private _intermediario9        As double
    Private _cveConcepto           As enumConceptoInterLiq 

    Private bAceptarNeg           As Boolean 


    Public Enum enumConceptoInterLiq 
       Monto_maximo    = 0
       Monto_actual    = 1
       Monto_remanente = 2
    End Enum




  Public Event PropertyChanged As PropertyChangedEventHandler  Implements INotifyPropertyChanged.PropertyChanged 
    
    Private Sub NotificarCambio (propname As string  )
         RaiseEvent PropertyChanged(me, new PropertyChangedEventArgs(propname) )
    End Sub



    Public Shared Function ValorInicalColumna(ByVal index As Integer) As Object     
        
         Select Case index
                Case 1 'Intermediario1
                     Return 0
                Case 2 'Intermediario2
                     Return 0
                Case 3 'Intermediario3
                     Return 0
                Case 4 'Intermediario4
                     Return 0
                Case 5 'Intermediario5
                     Return 0                                   
                Case 6 'Intermediario6
                     Return 0                     
                Case 7 'Intermediario7
                     Return 0                      
                Case 8 'Intermediario8
                     Return 0                     
                Case 9 'Intermediario9
                     Return 0                                      
                Case Else 
                     Return Nothing            
            End Select

        
    End Function


    Default  Property  Columna(ByVal index As Integer) As Object
         Get
            
            Select Case index 

               Case 0
                   Return _concepto 
               Case 1
                   Return _intermediario1  
               Case 2
                   Return _intermediario2 
               Case 3
                   Return _intermediario3
               Case 4
                   Return _intermediario4
               Case 5
                   Return _intermediario5
               Case 6
                   Return _intermediario6
               Case 7
                   Return _intermediario7
               Case 8
                   Return _intermediario8
               Case 9
                   Return _intermediario9

               Case Else 
                   Return Nothing 
            End Select

         End Get

         Set(ByVal value As Object)

         Select Case index 
                                  
               Case 1
                   Intermediario1  = value 
               Case 2                    
                   Intermediario2 = value 
               Case 3
                   Intermediario3 = value 
               Case 4
                   Intermediario4 = value 
               Case 5
                   Intermediario5 = value 
               Case 6
                   Intermediario6 = value 
               Case 7
                   Intermediario7 = value 
               Case 8
                   Intermediario8 =  value 
               Case 9
                   Intermediario9 = value 
               Case Else 
                   
            End Select

         End Set

     End Property

  
    Public ReadOnly Property CveConcepto() As enumConceptoInterLiq 
        Get
           Return _cveConcepto 
        End Get
    End Property

  
    Public ReadOnly  Property Concepto() As String
            Get
                Return _concepto 
            End Get            
    End Property
    

    Public Property Intermediario1() As Double 
        Get
            Return _intermediario1 
        End Get
        Set(ByVal value As Double  )
            
               If   value > 0 or bAceptarNeg = True  then                   
                       _intermediario1 = value                                                             
                Else                   
                      _intermediario1 = 0         
                   
               End If                         

               NotificarCambio("Intermediario1")    
   
        End Set


    End Property


    Public Property Intermediario2() As Double 
        Get
            Return _intermediario2
        End Get
        
        Set(ByVal value As Double)
        
           If value > 0 or bAceptarNeg = True then                
              _intermediario2 = value                               
           Else                                             
              _intermediario2 = 0                                                                        
           End If                         

           NotificarCambio("Intermediario2")                   
  
        End Set
    End Property


    Public Property Intermediario3() As Double 
        Get
            Return _intermediario3 
        End Get
        Set(ByVal value As Double)

          If  value > 0 or bAceptarNeg = True then 
              _intermediario3 = value                                              
          Else
              
              _intermediario3 = 0         
              
          End If              

          NotificarCambio("Intermediario3")       

        End Set
    End Property


    Public Property Intermediario4() As Double
        Get
            Return _intermediario4
        End Get
        Set(ByVal value As Double)

        If  value > 0 or bAceptarNeg = True then 
              _intermediario4 = value                                              
        Else           
           _intermediario4 = 0                               
        End If              

        NotificarCambio("Intermediario4")       
       
        End Set
    End Property


    Public Property Intermediario5() As Double
        Get
            Return _intermediario5
        End Get
        Set(ByVal value As Double)
   
        If  value > 0 or bAceptarNeg = True then 
              _intermediario5 = value                                              
        Else
              _intermediario5 = 0                                                                              
        End If              

        NotificarCambio("Intermediario5")       

        End Set
    End Property


    Public Property Intermediario6() As Double
        Get
            Return _intermediario6
        End Get
        Set(ByVal value As Double)
   
        If  value > 0 or bAceptarNeg = True then 
              _intermediario6 = value                                              
        Else
              _intermediario6 = 0                                                                              
        End If              

        NotificarCambio("Intermediario6")       

        End Set
    End Property


    Public Property Intermediario7() As Double
        Get
            Return _intermediario7
        End Get
        Set(ByVal value As Double)
  
        If  value > 0 or bAceptarNeg = True then 
              _intermediario7 = value                                              
        Else
              _intermediario7 = 0                                                                              
        End If              

        NotificarCambio("Intermediario7")               
        End Set
    End Property


    Public Property Intermediario8() As Double
        Get
            Return _intermediario8 
        End Get
        Set(ByVal value As Double)

        If  value > 0 or bAceptarNeg = True then 
              _intermediario8 = value                                              
        Else
              _intermediario8 = 0                                                                              
        End If              

        NotificarCambio("Intermediario8")       

        End Set
    End Property


    Public Property Intermediario9() As Double
        Get
            Return _intermediario9
        End Get
        Set(ByVal value As Double)
    
        If  value > 0 or bAceptarNeg = True then 
              _intermediario9 = value                                              
        Else
              _intermediario9 = 0                                                                              
        End If              

        NotificarCambio("Intermediario9")       
        
        End Set
    End Property



 Public Sub New(ByVal concepto As enumConceptoInterLiq )


     


     Select Case concepto
         Case enumConceptoInterLiq.Monto_maximo 
             bAceptarNeg = False 
             _concepto = "Monto máximo"
             _cveConcepto = enumConceptoInterLiq.Monto_maximo 
         Case enumConceptoInterLiq.Monto_actual 
             bAceptarNeg = False 
             _concepto = "Monto actual"
             _cveConcepto = enumConceptoInterLiq.Monto_actual 
         Case enumConceptoInterLiq.Monto_remanente 
            bAceptarNeg = True 
            _concepto = "Monto remanente"
            _cveConcepto = enumConceptoInterLiq.Monto_remanente 
     End Select



    'Intermediarios

    _intermediario1   = 0
    _intermediario2   = 0
    _intermediario3   = 0
    _intermediario4   = 0
    _intermediario5   = 0
    _intermediario6   = 0
    _intermediario7   = 0
    _intermediario8   = 0
    _intermediario9   = 0



    End Sub











End Class
